<%@ page pageEncoding="utf-8"%> 
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>

<%
	request.setCharacterEncoding("utf-8");
	request.setAttribute("layout","main.jsp");
	request.setAttribute("page_title","温岭选课系统-课程列表");
	List<Hashtable<String, String>> course_list = (List<Hashtable<String, String>>) session.getAttribute("StudentSelectList");
	Iterator<Hashtable<String, String>> course_it = course_list.iterator();
	String studentId = (String)session.getAttribute("studentId");
	String studentname = (String)session.getAttribute("studentname");
	String studentno = (String)session.getAttribute("studentno");
	double credit = 0;
%>
<style>

</style>

<link href="css/jquery.ui.tabs.css" rel="stylesheet">
	<link href="css/jquery.ui.theme.css" rel="stylesheet">
	<link href="css/div_win.css" rel="stylesheet"> 
	<script src="js/div_win.js"></script>
	<script src="js/jquery-1.5.2.min.js"></script>
	<script src="js/jquery-ui-1.8.11.custom.min.js"></script>
	<script src="js/jquery.ui.tabs.js"></script>
	<script type="text/javascript" src="js/popup.js"></script>
	
	<script>
	$(function() {
		$( "#tabs" ).tabs();
	});
	
	function unselect(courseId,name){
	   $.ajax({
			url: base_path+"Student/unselect.do",
			type: "POST",
			data: {"method":"measuring"},
            data: {"courseId":courseId}, 
			beforeSend: function(XMLHttpRequest){
				return confirm("确要退选《"+name+"》吗?");
			},
			success: function(data, textStatus){
				if(data=="success"){
					alert("恭喜您，退选课程成功！");
				}else{ 
					alert("恭喜您，退选课程成功！");
				}
			},

			complete: function(XMLHttpRequest, textStatus){
				window.location.href=base_path+"Student/mySelect.do";
			},
			error: function(){
				alert("服务器异常，请联系网络管理员");
			}
		});
   }
   
	</script>
<div style="width:100%; margin:1px;text-align:center;margin-top:5px;margin-bottom:20px;">
 	
 	<p style="border:0;font-size:14px;padding-bottom:0;text-align:center;">
	</p>
	  
<div style="width:100%;margin-left:0;padding-left:0;margin-top:20px;">
<style>
	tr{
		height:30px;
	}
	.tdLeft{
		align:left;
		text-align:left;
		padding-left:20px;
		
	}
</style>
  <p style="border:0;font-size:14px;padding-bottom:0;">
  	 <b><%=studentname %>（<%=studentno %>）的选课详情&nbsp;&nbsp;<a href="Search/searchCourse.do?studentId=<%=studentId %>&src=admin">增加选课</a></b>
  </p>
  <table   style="border:1px solid gray;margin-left:1%;width:98%;">
    <tbody>
              <tr height="32" bgcolor="#f0f0f0">
                    <td align="center" width="7%">课程编号</td>
                    <td align="center" width="8%">课程类型</td>
                    <td align="center" width="14%">课程名称</td>
                    <td align="center" width="7%">授课老师</td>
                    <td align="center" width="13%">上课时间|地点</td>
                    <td align="center" width="6%">学分</td>
                    <td align="center" width="10%">人数限额<br>
                      (最多/最少)</td>
                    <td align="center" width="6%">已选人数</td>
                    <td align="center" width="7%">选课状态</td>
                    <td align="center" width="15%">操作</td>
             </tr>
           <%
            course_it = course_list.iterator();
		    while(course_it.hasNext())
			{
				Hashtable<String, String> cousrelist_hash  = course_it.next();
				credit += Double.parseDouble(cousrelist_hash.get("credit"));
			%>
			  	<tr height="25" bgcolor="#ffffff">
		            <td align="center"><%=cousrelist_hash.get("classno") %></td>
		            <td align="center"><%=cousrelist_hash.get("type") %></td>
		            <td align="center"><%=cousrelist_hash.get("name") %> </td>
		            <td align="center"><%=cousrelist_hash.get("teachers") %> </td>
		            <td align="center"><%=cousrelist_hash.get("teach_time") %> | <%=cousrelist_hash.get("teach_location") %> </td>
		            <td align="center"><%=cousrelist_hash.get("credit") %> </td>
		            <td align="center"><%=cousrelist_hash.get("students_low") %>/<%=cousrelist_hash.get("students_high") %> </td>
		            <td align="center"><%=cousrelist_hash.get("num_of_students") %> </td>
		            
		            <td align="center">
		            <% if(cousrelist_hash.get("status") == null){%>
			             审核中
				    <% }else if(cousrelist_hash.get("status") == null){ %>
				  审核通过
				    <%}else if(cousrelist_hash.get("status") == null){ %>
				  审核不通过
				    <%} %>
		            </td>
		            <td align="center">
		                 <a href="Admin/deleteChoose.do?courseId=<%=cousrelist_hash.get("Id")%>&studentId=<%=studentId %>&src=admin"   class="approve">退选</a>
		            </td>
		         </tr>
		         <%} %>
      </tbody>
    </table>
    <p style="border:0;font-size:12px;padding-bottom:0;padding-right:20px;padding-top:20px;text-align:right;">
  		<b>总修学分数：<%=credit %></b>
	</p>
</div>
</div>
